<!DOCTYPE html>
<html>

	<meta charset="UTF-8">
	<title>Title</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<meta name="format-detection" content="telephone=no, email=no" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta name="apple-mobile-web-app-status-bar-style" content="black" />

	</head>

	<body>

		<div id="div1">
			<input class="active" type="button" value="11111" />
			<input type="button" value="22222" />
			<input type="button" value="33333" />
			<div style="display:block;">一一一一一</div>
			<div style="display:none;">二二二二二</div>
			<div style="display:none;">三三三散散</div>
		</div>

		<script type="text/javascript">
			//构造函数
						function Pro(name, age, sex, obj, bb, huibb) {
							this.name = name;
							this.age = age;
							this.sex = sex;
							this.obj = obj;
							this.bb = bb;
							this.huibb = huibb;
						}
			
						var xin = new Pro("小明", 18, "男", "有男朋友", "会说话", "去吃饭");
						document.write(xin.name + xin.age + xin.sex + xin.obj + xin.bb + xin.huibb+"<br />");

			//工厂模式
						function creatCar() {
			//创建一个汽车对象
							var car = new Object();
							car.brend = '宝马';
							car.hege = '合格';
							car.price = '$100';
							car.shuom = '踩油门';
							return car;
						}
						var car1 = creatCar();
						document.write(car1.brend+car1.hege+car1.price+car1.shuom+"<br />");

				

			function Tabfoo(id) {
				var oDiv = document.getElementById(id);
				this.aBtn = oDiv.getElementsByTagName('input');
				this.aDiv = oDiv.getElementsByTagName('div');
				var i = 0;
				var _this = this; 
				for(i = 0; i < this.aBtn.length; i++) {
					this.aBtn[i].index = i;
					this.aBtn[i].onclick = function() {
						_this.tab(this); 
					};

				}
			};
			Tabfoo.prototype.tab = function(oBtn) {
				for(i = 0; i < this.aBtn.length; i++) {
					this.aDiv[i].style.display = 'none';
				}
				this.aDiv[oBtn.index].style.display = 'block';
			}
			var obj = new Tabfoo("div1");
		</script>
	</body>

</html>